package com.example.learn_spring_boot3.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@TableName("user_order")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserOrder {
    @TableId(type = IdType.AUTO)
    public Integer id;
    public Integer userId; // 这里 mybatis-plus 会自动驼峰命名转换, 对应的数据库字段为 user_id
    public String name;

    // 关联的用户
    @TableField(exist = false)
    public User user;
}
